﻿using System;

namespace OperationPlugins
{
    /// <summary>
    /// Used to tell that a plugin only applies to the specified BranchId.
    /// </summary>
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
    public class BranchFilterAttribute : Attribute
    {
        private readonly string _branchId;

        /// <summary>
        /// Initializes a new instance of the BranchFilterAttribute class.
        /// </summary>
        /// <param name="branchId">BranchId</param>
        public BranchFilterAttribute(string branchId)
        {
            if (branchId == null)
            {
                throw new ArgumentNullException("branchId");
            }

            _branchId = branchId;
        }

        /// <summary>
        /// Gets the BranchId.
        /// </summary>
        public virtual string Value
        {
            get { return _branchId; }
        }

    }

    internal sealed class InternalBranchFilterAttribute : BranchFilterAttribute
    {
        public InternalBranchFilterAttribute() : base(Branches.InternalBranchId)
        {
        }
    }

}